﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using NBFBLL;
using System.ServiceModel.Web;
using System.ServiceModel.Activation;
using System.Collections;
using System.Data;
using NBFModel;

namespace NBFWcfService
{
    // 注意: 如果更改此处的类名 "RemindService"，也必须更新 Web.config 中对 "RemindService" 的引用。
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class RemindService : IRemindService
    {
        RemindSetBLL rsbll = new RemindSetBLL();

        


        #region IRemindService 成员


        [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, Method = "POST")]
        public bool InsertUpdateGZ(Hashtable ht)
        {
            //return false;
            string yingli, kuisun, jjdms, userid, startday, lxids, txContents;
            yingli = ht["yingli"].ToString();
            kuisun = ht["kuisun"].ToString();
            jjdms = ht["jjdms"].ToString();
            userid = ht["userid"].ToString();
            startday = ht["startday"].ToString();
            lxids = ht["lxids"].ToString();
            txContents = ht["txContents"].ToString();
            string[] jjdmar = jjdms.Split(',');
            string[] lxidar = lxids.Split(',');
            string[] txContentar = txContents.Split(',');
            return rsbll.InsertUpdateGZ(yingli, kuisun, ArrayList.Adapter(jjdmar), userid, startday, ArrayList.Adapter(lxidar), ArrayList.Adapter(txContentar));

        }

        [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, Method = "POST")]
        public bool UpdateGroupFundSetting(Hashtable ht)
        {
            string startday = ht["startday"].ToString();
            string yingli = ht["yingli"].ToString();
            string kuisun = ht["kuisun"].ToString();
            string userid = ht["userid"].ToString();
            string zdid = ht["zdid"].ToString();

           return rsbll.UpdateGroupFundSetting(startday, yingli, kuisun, userid, zdid);
        }

        [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, Method = "POST")]
        public DataTable getJJSetData(Hashtable ht)
        {
            string userid = ht["userid"].ToString();
            bool isft = (bool)ht["isft"];
            DataTable dt =  rsbll.getJJSetData(userid, isft);
            return dt;
        }

        [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, Method = "POST")]
        public  bool UpdateGZByJJDM(Hashtable ht)
        {
            //string userid, string jjdm, string yingli, string kuisun, string startDay, string tx_Type, ArrayList txContent, string gzid
            string userid = ht["userid"].ToString();
            string jjdm = ht["jjdm"].ToString();
            string yingli = ht["yingli"].ToString();
            string kuisun = ht["kuisun"].ToString();
            string startday = ht["startDay"].ToString();
            string tx_type = ht["tx_Type"].ToString();
            string txContents = ht["txContent"].ToString();
            string [] txContentar = txContents.Split(',');
            string gzid = ht["gzid"].ToString();

            return   rsbll.UpdateGZByJJDM(userid, jjdm, yingli, kuisun, startday, tx_type, ArrayList.Adapter(txContentar), gzid);

        }

        [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, Method = "POST")]
        public bool DeleteGZByID(Hashtable ht)
        {
            string userid = ht["userid"].ToString();
            string jjdm = ht["jjdm"].ToString();
            return rsbll.DeleteGZByID(userid, jjdm);
        }


        [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, Method = "POST")]
        public DataTable GetGZByUserID(string userID)
        {
            return  rsbll.GetGZByUserID(userID);
        }

        [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, Method = "POST")]
        public bool deleteJJSetData(Hashtable ht)
        {
            string userid = ht["userid"].ToString();
            string jjdm = ht["jjdm"].ToString();
            rsbll.deleteJJSetData(userid, jjdm);
            return false;
        }

        [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, Method = "POST")]
        public void updateZX(Hashtable ht)
        {
            string [] ids = ht["ids"].ToString().Split(',');
            string userid = ht["userid"].ToString();
            rsbll.updateZX(ArrayList.Adapter(ids), userid);
        }

        [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, Method = "POST")]
        public bool InsertTXSet(TB_zdgl_DayMyself dm)
        {
            return rsbll.InsertTXSet(dm);
        }

        [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, Method = "POST")]
        public bool UpdateTXSet(TB_zdgl_DayMyself dm)
        {
            return rsbll.UpdateTXSet(dm);
        }

        [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, Method = "POST")]
        public bool DeleteTXSet(List<string> ids)
        {
            return rsbll.DeleteTXSet(ids);
        }

        [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, Method = "POST")]
        public void UpdateZuheJJ(Hashtable ht)//(ArrayList Lx, int ZuheType, string userid)
        { 
            string [] lxs = ht["lxs"].ToString().Split(',');
            int ZuheType = (int)ht["ZuheType"];
            string userid = ht["userid"].ToString();
            rsbll.UpdateZuheJJ(ArrayList.Adapter(lxs), ZuheType, userid);
        }

        #endregion

    }


    
}
